package com.aiyige.model.request;

import com.aiyige.base.api.ApiManager;

import okhttp3.ResponseBody;
import retrofit2.Call;

/**
 * Created by xiachao
 */

public class OrderDetailRequest {
    public static final int type_buyer = 1;
    public static final int type_seller = 2;

    public static final String orderCodeType = "orderCode";//默认可以不填，不填按订单id查询，如果填写pingOrderCode则通过pingOrderCode查

    String id;
    int type = type_buyer;

    String orderCode;

    private OrderDetailRequest(Builder builder) {
        id = builder.id;
        type = builder.type;
        orderCode= builder.orderCode;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public static final class Builder {
        private String id;
        private int type;
        private String orderCode;

        private Builder() {
        }

        public Builder orderCode(String orderCode) {
            this.orderCode = orderCode;
            return this;
        }

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder type(int type) {
            this.type = type;
            return this;
        }

        public Call<ResponseBody> build() {
            if (type == type_buyer) {
                return ApiManager.getService().getBuyerOrderDetail(id,orderCode);
            } else {
                return ApiManager.getService().getSellerOrderDetail(id,orderCode);
            }
        }
    }
}
